#!/usr/bin/env ruby

LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))

require "#{LKP_SRC}/lib/string_ext"

keys = %w(read_ios read_merges read_sectors read_ticks
          write_ios write_merges write_sectors write_ticks
          in_flight io_ticks time_in_queue)

$stdin.each_line do |line|
  line = line.resolve_invalid_bytes
  if line =~ /^time: /
    puts line
    next
  end

  data = line.split
  next if data.size != keys.size + 3

  dev_name = data[2]
  data[3..-1].each_with_index do |v, i|
    puts "#{keys[i]}.#{dev_name}: #{v}"
  end
end
